﻿using System;
using System.Threading.Tasks;
using battlenet.wow.rt.domain.objects;
using battlenet.wow.rt.sdk.data.dto;
using battlenet.wow.rt.sdk.objects.Mapper;

namespace battlenet.wow.rt.sdk.Data.Proxy
{
    internal class CharacterProfileProxy : BattlenetApiProxy<CharacterProfileInfo>
    {

        public async Task<WowCharacter> GetCharacterProfileAsync(string realm, string characterName, params string[] fields)
        {
            var resource = string.Format(BattlenetApiResource.CharacterProfile, realm, characterName);

            if (fields.Length > 0)
            {
                resource += "?fields=";
                resource += string.Join(",", fields);
            }

            var response = await RequestDataAsync(resource);
            return response.Remap(new CharacterProfileMapper());
        }
    }
}